<!DOCTYPE html>
<extend name="Base:base"/>
<block name="title"><title>欢迎登陆</title>
<import type='js'  file='Js.jquery'/> 
<import type='js'  file='Js.login'/> 
<import type='css' file='Css.logreg'/>
</block>
<block name="content">
<script>
    //验证用户填写的信息是否正确
function proof(){
    var username=document.getElementById("username").value;
    var password=document.getElementById("password").value;
    //如果用户信息格式正确提交表单
    if(username!=""&&password!=""){
      $.ajax({
          url: "{:U('/Home/User/checkLogin')}",
          type: 'POST',
          dataType: 'json',
          data: {
            username: username,
            password: password
        },
      })
      .done(function(data) {
        console.log(data);
          if(data.code == 200){
            location.href = "{:U('/Home/User/main')}";
          } else {
            alert(data.msg);
          }
      })
      .fail(function() {
          console.log("error");
      })
      .always(function() {
          console.log("complete");
      });
    }
}
</script>
<div class="login-main"style="background: url(__PUBLIC__/img/login.png) ">
    <div class="login-mainBox">
        <div class="clearFiy">
        </div>
        <div class="show">
            <img src="__PUBLIC__/img/loginshow.png">
            <div class="explain">
                “指间岁月 淡淡的怀念”<br/>
                 摄于：天津大学<br/>
                 by  李方方<br/>
            </div>
        </div>
		<!-- form 提交方法-->
        <form action="main.html" method="post"name="loginForm" id="loginForm">
        <div class="login-form">
            <div class="usernameBox ">
                <input id="username" class="username" type="text" placeholder="twitterhandle" tabindex="1" curr_val="4">
                <label class="placeholder1" for="username" style="">
                    输入手机号
                </label>
            </div>
            <div class="passwordBox ">
                <input id="password" class="password"  type="password"tabindex="2">
                <label class="placeholder2" for="password">
                    输入密码
                </label>
            </div>
            <div class="forgetPassword">
			    <!--登录错误提示-->
                <p id="mistaketip" class="mistake" id="mistake">示例</p>
                <a href="getPassword">忘记密码></a>
                <a href="register">注册></a>
            </div>
            <div class="loginBottom">
                 <a  href="javascript:" class="loginButton" onclick="proof()" tabindex="3">登陆&nbsp;&nbsp;>weyin</a>
            </div>
        </div>
        </form>
    </div>
</div>
</block>
